﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIOGDE.Negocios
{
    public class DateFormatter
    {        
        public static DateTime CastToDate(string stringDate)
        {
            DateTime parsed;
            if (DateTime.TryParse(stringDate, out parsed))
            {
                return parsed;       
            }

            return DateTime.Now;
        }

        public static DateTime? CastToDateNullable(string stringDate)
        {
            DateTime parsed;
            if (DateTime.TryParse(stringDate, out parsed))
            {
                return parsed;
            }

            return null;
        }
    }
}
